<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<title><%= VUE_APP_TITLE%></title>
	<link rel="stylesheet" href="<%= VUE_APP_BASE_URL %>css/font-awesome.css">
	<script src="<%= VUE_APP_BASE_URL %>js/TronWeb.js"></script>
	<script>
		var _hmt = _hmt || [];
		(function() {
			var hm = document.createElement("script");
			hm.src = "https://hm.baidu.com/hm.js?87766e624d627ac09e1d092c43683743";
			var s = document.getElementsByTagName("script")[0];
			s.parentNode.insertBefore(hm, s);
		})();
	</script>
	<style>
		html,body{min-height:100vh;}
		.loading{background-image:url(/images/ball-triangle.svg);background-repeat: no-repeat;background-position:center center;}
	</style>
</head>
<body class="loading " >
	<div id="app"></div>
	<script src="<%= VUE_APP_BASE_URL %>js/jquery.min.js"></script>
	<script src="<%= VUE_APP_BASE_URL %>js/layer.js"></script>
	<script src="<%= VUE_APP_BASE_URL %>js/sweetalert2@8.js"></script>
	<script>
		$(function () {
			//复制
			$(document).on('click','.JS-copy',function () {
				var $this = $(this);
				var element = $this.prev('.copytext').get(0);
				var error = '浏览器不支持，请手动复制！';
				if (document.body.createTextRange) {
					console.log('创建选择区域方式1');
					var range = document.body.createTextRange();
					range.moveToElementText(element);
					range.select();
				} else if (window.getSelection) {
					console.log("创建选择区域方式2");
					var selection = window.getSelection();
					var range = document.createRange();
					range.selectNodeContents(element);
					selection.removeAllRanges();
					selection.addRange(range);
				} else {
					return alert(error + 1);
				}
				try {
					if (document.execCommand('copy', false, null)) {
						layer.msg('复制成功');
						console.log('已复制？');
					} else {
						alert(error + 2)
					}
				} catch (err) {
					alert(error + 3)
				}
			})
		})

		//监听钱包的登录、切换操作，并刷新
		window.addEventListener('message', function (e) {
			if (e.data.message && (e.data.message.action == "setAccount" || e.data.message.action == "setNode")) {
				let sender = localStorage.getItem('sender')
				if (sender && (sender != e.data.message.data.address)) { //切換賬戶
					window.location.reload();
				}
			}
		});
	</script>
</body>
</html>
